package adv1;

import java.util.*;

public class ListTest {

	public static void main(String[] args) {
		List list = new ArrayList(20);
		System.out.println(list.size());
		System.out.println(">>>>>>>>>>>>>>>>>>");
		for (int i = 1; i < 40; i++) {
			list.add("狗" + i);
		}
		System.out.println(list);
		System.out.println(">>>>>>>>>>>>>>." + list.size());
		Object str = list.get(5);
		System.out.println(str);
		String s2 = (String) list.get(7);
		System.out.println(s2);
		String del = (String) list.remove(14);
		System.out.println(del + " 被删除后，长度是" + list.size());
		boolean e = list.remove("狗3");
		System.out.println("狗3删除成功了？" + e);
		System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
		list.set(9, "陈达星");
		for (int i = 0; i < list.size(); i++) {
			System.out.println(list.get(i));
		}
		boolean in = list.contains("狗10");
		System.out.println("包含狗10？" + in);
		int pos = list.indexOf("狗仔子");// 位置
		System.out.println("位置：" + pos);
	}

}
